﻿@model CultuRAM.Models.Parameter  
@{
    int idP = ViewBag.IdParam;
    int pag = ViewBag.Page ?? 1;
}

<h4>Editar valor do Parâmetro</h4>
<br /><br />

@using (Ajax.BeginForm("EditGeneric", "Parameters", new { idParam = idP, page = pag }, new AjaxOptions
{
    UpdateTargetId = "formParam",
    InsertionMode = InsertionMode.Replace,
    HttpMethod = "POST",
    OnSuccess = "UpdateListParam(" + pag + "," + idP + ")"
}))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>EventType</legend>
        
        @Html.HiddenFor(model => model.IdParam)

        @switch (idP)
        {
            case 1:
                <div class="control-group">          
                    @Html.LabelFor(model => model.WebpagesRole.RoleName, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.WebpagesRole.RoleName, new {@class = "span4"})
                        @Html.HiddenFor(model => model.WebpagesRole.RoleId)
                    </div>
                </div>
                break;
            case 2:
                <div class="control-group">      
                    @Html.LabelFor(model => model.EventType.Type, new { @class = "control-label" })
                    <div class="controls">        
                        @Html.EditorFor(model => model.EventType.Type, new {@class = "span4"})
                        @Html.HiddenFor(model => model.EventType.TypeId)
                    </div>
                </div>
                <div class="control-group">
                    @Html.LabelFor(model => model.EventType.Color, new { @class = "control-label" })
                    <div class="controls">
                        @Html.TextBoxFor(model => model.EventType.Color, new {@class = "span4", @type="color"})
                    </div>
                </div>
                <div class="control-group">
                    @Html.LabelFor(model => model.EventType.SuperType, new { @class = "control-label" })
                    <div class="controls">
                        @Html.DropDownListFor(model => model.EventType.SuperTypeId, (SelectList)ViewBag.SuperTypeId, "- Selecione - ", new {@class="span4"})  
                    </div>
                </div>    
                             
                break;
            case 3:
                <div class="control-group">
                    @Html.LabelFor(model => model.ResourceType.ResType, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.ResourceType.ResType, new {@class = "span4"})
                        @Html.HiddenFor(model => model.ResourceType.ResTypeId)
                    </div>
                </div>
                break;
            case 4:
                <div class="control-group">
                    @Html.LabelFor(model => model.EntityType.EntityTypeName, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EntityType.EntityTypeName, new {@class = "span4"})
                        @Html.HiddenFor(model => model.EntityType.EntityTypeId)
                    </div>
                </div>
                break;
            case 5:
                <div class="control-group">
                    @Html.LabelFor(model => model.ParticipantType.ParticipType, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.ParticipantType.ParticipType, new {@class = "span4"})
                        @Html.HiddenFor(model => model.ParticipantType.ParticipTypeId)
                    </div>
                </div>
                break;
            case 6:
               <div class="control-group">
                    @Html.LabelFor(model => model.AccreditingState.AccState, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.AccreditingState.AccState, new {@class = "span4"})
                        @Html.HiddenFor(model => model.AccreditingState.AccStateId)
                    </div>
                </div>
                break;
            case 7:    
                <div class="control-group">
                    @Html.LabelFor(model => model.EventState.State, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EventState.State, new {@class = "span4"})
                        @Html.HiddenFor(model => model.EventState.StateId)
                    </div>
                </div>   
                break;
            case 8:                      
                <div class="control-group">
                    @Html.LabelFor(model => model.City.CityName, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.City.CityName, new {@class = "span4"})
                        @Html.HiddenFor(model => model.City.CityId)
                    </div>
                </div> 
                break;
            case 9:
                <div class="control-group">
                    @Html.LabelFor(model => model.Place.NamePlace, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.Place.NamePlace, new {@class = "span4"})
                        @Html.HiddenFor(model => model.Place.PlaceId)
                    </div>
                </div> 
                break;
            case 10:
               <div class="control-group">
                    @Html.LabelFor(model => model.Participant.Name, new { @class = "control-label" })
                    <div class="controls">
                        @Html.TextBoxFor(model => model.Participant.Name, new {@class = "span12"})
                        @Html.HiddenFor(model => model.Participant.ParticipId)
                    </div>
                </div> 
                <div class="row-fluid">
                    <div class="span4">
                        <div class="control-group">
                            @Html.LabelFor(model => model.Participant.ParticipantType.ParticipType, new { @class = "control-label" })
                            <div class="controls">
                                @Html.DropDownListFor(model => model.Participant.ParticipantTypeId, (SelectList)ViewBag.ParticipantTypeId, " - Selecione -", new {@class = "span10"}) 
                            </div>
                        </div> 
                    </div>
                    <div class="span5">
                        <div class="control-group">
                            @Html.LabelFor(model => model.Participant.Photo, new { @class = "control-label" })
                            <div class="controls">
                                @Html.TextBoxFor(model => model.Participant.Photo, new {@class = "span8"})
                                <a class="btn btn-default" href="#" style="margin-bottom: 10px;"><i class="fa fa-photo"></i></a>
                            </div>
                        </div> 
                    </div>
                    <div class="span3">
                        <div class="control-group">
                            @Html.LabelFor(model => model.Participant.Active, new { @class = "control-label" })
                            <div class="controls">
                                @Html.EditorFor(model => model.Participant.Active, new {@class = ""})
                            </div>
                        </div> 
                    </div>
                </div>
                <div class="control-group">
                    @Html.LabelFor(model => model.Participant.Curriculum, new { @class = "control-label" })
                    <div class="controls">
                        @Html.TextAreaFor(model => model.Participant.Curriculum, new {@class = "span12"})
                    </div>
                </div> 
                break;
            case 11:
                <div class="control-group">
                    @Html.LabelFor(model => model.EventProperty.Name, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EventProperty.Name, new {@class = "span4"})
                        @Html.HiddenFor(model => model.EventProperty.PropertyId)
                    </div>
                </div> 
                <div class="control-group">
                    @Html.LabelFor(model => model.EventProperty.Kind, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EventProperty.Kind, new {@class = "span4"})
                    </div>
                </div> 
                <div class="control-group">
                    @Html.LabelFor(model => model.EventProperty.DefaultValue, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EventProperty.DefaultValue, new {@class = "span4"})
                    </div>
                </div>       
                <div class="control-group">
                    @Html.LabelFor(model => model.EventProperty.Mandatory, new { @class = "control-label" })
                    <div class="controls">
                        @Html.EditorFor(model => model.EventProperty.Mandatory, new {@class = "span4"})
                    </div>
                </div>          
                break;
            default:
                <div class="alert alert-danger"><br /><br />Sem dados... <br /><br /></div>
                break;
        }  
        <br/>
                <p>
                    <button class="btn btn-primary" value="Guardar" type="submit"><i class="icon-ok icon-white"></i> Guardar</button>
                    @Html.Raw(@Ajax.ActionLink("replacetxt", "DefaultRight", null, new AjaxOptions()
                                {
                                    UpdateTargetId = "formParam",
                                    InsertionMode = InsertionMode.Replace,
                                    OnSuccess = "ParamBgColorClear()",
                                }, new { @class = "btn btn-default" })
		                                .ToHtmlString().Replace("replacetxt", "<i class=\"icon-ban-circle\"></i> Cancelar"))
                </p>
   
    </fieldset>
    
}



@*@Scripts.Render("~/bundles/jqueryval")*@
@Scripts.Render("~/bundles/culturam")

@*<script>
    function UpdateListParam(pag, idP) {
        //alert("P: " + pag);
        
        $.ajax({
            url: '/Parameters/ListParameters',
            dataType: 'html',
            type: 'GET',
            data: {page: pag, idParam: idP},
            success: function (data) {
                jQuery.validator.unobtrusive.parse('#listParam');
                $('#listParam').html(data);
            },
            error: function () {
                alert("ERRO: ao tentar abrir formulário...");
            }
        });
    }

</script>*@